package com.blb.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blb.entity.Staff;
import com.blb.entity.User;
import com.blb.mapper.StaffMapper;
import com.blb.service.IStaffService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author HuaHao
 * @since 2019-11-15
 */
@Service
public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> implements IStaffService {

    @Resource
    private StaffMapper staffMapper;

    /**
     * 员工管理分页模糊查询
     * @param cId
     * @param start
     * @param length
     * @param name
     * @param dId
     * @return
     */
    @Override
    public List<Staff> getStaffs(String cId,int start, int length, String name, String dId) {
        return staffMapper.getStaffs(cId,start, length, name, dId);
    }
    /**
     * 按条件查询总条数
     * @param name
     * @param dId
     * @return
     */
    @Override
    public int count(String cId,String name, String dId) {
        return staffMapper.count(cId,name, dId);
    }
    /**
     * 通过员工id找到员工和部门和职位信息
     * @param id
     * @return
     */
    @Override
    public Map<String, Object> selectAllById(String id) {
        return staffMapper.selectAllById(id);
    }
    /**
     * 修改员工的账号状态
     * @param id
     * @param status
     */
    @Override
    public void updateStatus(String id, String status) {
        staffMapper.updateStatus(id, status);
    }
    /**
     * 批量修改员工的账号状态
     * @param ids
     */
    @Override
    public void updateAllStatus(String[] ids) {
        staffMapper.updateAllStatus(ids);
    }

    @Override
    public User select(String userTel, String no, String userName) {
        return staffMapper.select(userTel, no, userName);
    }


}
